//2009/08/02 16:29:51
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <set>
#include <math.h>

using namespace std;

class HourGlass
{
public:
    vector <int> measurable(int glass1, int glass2)
    {
        set<int> result;
        for (int i=0; i<11; i++)
        {
            for (int j=0; j<11; j++)
            {
                if (i == 0 && j == 0) continue;
                result.insert(glass1 * i + glass2 * j);
                for (int k=0; k<11; k++)
                {
                    result.insert(glass1 * i + k*abs(glass1*i - glass2*j));
                    result.insert(glass2 * j + k*abs(glass1*i - glass2*j));
                }
            }
        }

        vector<int> s;
        set<int>::iterator it;
        int i;
        for (i=0, it = result.begin() ; i<10; i++, it++)
        {
            if ((*it) == 0)
            {
                i--;
                continue;
            }
            s.push_back(*it);
        }
        return s;
    }
};
